object TestWhile {

  def addInner() {
    var res = 0
    for (i <- 0 until 10) {
      if (i == 5) {
        return
      }
      res += i
      println("res = " + res)
    }
  }

  def add(x: Int, y: Int): Int = {
    x + y
  }

  def fibonacci(n: Int):Long = {
    if (n<=2) return 1
    fibonacci(n-1) + fibonacci(n-2)
  }

  def main(args: Array[String]): Unit = {
//    addInner()
//    println(add(4,5))
    println(fibonacci(6))
    import scala.util.control.Breaks._
    var res = 0
    breakable {
      for (i <- 0 until 10) {
        if (i == 5) {
          break
        }
        res += i
      }
    }
    println("res = " + res)
  }

}
